<template>
  <div id="buttomAge"></div>
</template>
<script setup lang="ts">
import { onMounted } from '@vue/runtime-core'
import * as Echarts from 'echarts'
import moment from 'moment'
import { fontSize } from '@/utils/tools'
// const chartId = `${moment().valueOf()}`
const option = {
    color: ['#32CCB6', '#FFC800', '#FA611F', '#FF739D', '#CD57FF', '#575BFF'],
    title: {
      text: "服务人员从业年限",
      left: "center",
      textStyle: {
      fontSize: fontSize(20)
      },
    },
    tooltip: {
        trigger: 'item',
        formatter: '{b}: {d}%'
    },
    series: [
      {
        name: '人员占比',
        type: 'pie',
        radius: ['40%', '60%'],
        left: 'center',
        avoidLabelOverlap: false,
        emphasis: {
          label: {
            show: true,
            fontSize: fontSize(14),
            fontWeight: 'bold'
          }
        },
        label: {
          formatter: '{a}:{d}%'
        },
        labelLine: {
            show: true,
            length: fontSize(10),
            length2: fontSize(35),
            fontSize: fontSize(20),
            maxSurfaceAngle: fontSize(80)
        },
        data: [
            {value: 10, name: '1年'},
            {value: 4, name: '2年',},
            {value: 2, name: '3年',},
            {value: 10, name: '5年',},
            {value: 8, name: '5年以上',},
            {value: 21, name: '无经验'},
        ]
      }
    ]
}
onMounted(() => {
  let myChart = Echarts.init(document.getElementById('buttomAge'))
  myChart.setOption(option)
})
</script>
<style lang="less" scoped>
  .box {
  color: #60d659;
  }
</style>
